/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.jr2tecnologia.model.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author ronildo
 */
@Entity
@Table(name = "client_phone")
@NamedQueries({
    @NamedQuery(name = "ClientPhone.findAll", query = "SELECT c FROM ClientPhone c"),
    @NamedQuery(name = "ClientPhone.findByPkClientPhone", query = "SELECT c FROM ClientPhone c WHERE c.pkClientPhone = :pkClientPhone"),
    @NamedQuery(name = "ClientPhone.findByName", query = "SELECT c FROM ClientPhone c WHERE c.name = :name"),
    @NamedQuery(name = "ClientPhone.findByPhone", query = "SELECT c FROM ClientPhone c WHERE c.phone = :phone")})
public class ClientPhone implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "pk_client_phone")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator="seq_client_phone")
    @SequenceGenerator(name="seq_client_phone", sequenceName="seq_client_phone", allocationSize=1)
    private Long pkClientPhone;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @Column(name = "phone")
    private String phone;
    @JoinColumn(name = "fk_login", referencedColumnName = "pk_login")
    @ManyToOne(optional = false)
    private Login login;
    @JoinColumn(name = "fk_company", referencedColumnName = "pk_company")
    @ManyToOne(optional = false)
    private Company company;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "clientPhone")
    private List<SmsSend> smsSendList;

    public ClientPhone() {
    }

    public ClientPhone(Long pkClientPhone) {
        this.pkClientPhone = pkClientPhone;
    }

    public ClientPhone(Login login) {
        this.login = login;
    }

    public ClientPhone(Long pkClientPhone, String name, String phone) {
        this.pkClientPhone = pkClientPhone;
        this.name = name;
        this.phone = phone;
    }

    public Long getPkClientPhone() {
        return pkClientPhone;
    }

    public void setPkClientPhone(Long pkClientPhone) {
        this.pkClientPhone = pkClientPhone;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Login getLogin() {
        return login;
    }

    public void setLogin(Login login) {
        this.login = login;
    }

    public Company getCompany() {
        return company;
    }

    public void setCompany(Company company) {
        this.company = company;
    }

    public List<SmsSend> getSmsSendList() {
        return smsSendList;
    }

    public void setSmsSendList(List<SmsSend> smsSendList) {
        this.smsSendList = smsSendList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pkClientPhone != null ? pkClientPhone.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ClientPhone)) {
            return false;
        }
        ClientPhone other = (ClientPhone) object;
        if ((this.pkClientPhone == null && other.pkClientPhone != null) || (this.pkClientPhone != null && !this.pkClientPhone.equals(other.pkClientPhone))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.jr2tecnologia.model.entity.ClientPhone[pkClientPhone=" + pkClientPhone + "]";
    }

}
